<?php session_start();?>
<?php 
    require_once ("./config.inc.php");
	require_once ("./include/mysql.inc.php");
	require_once ("./include/article.inc.php");
	require_once ("./include/articleType.inc.php");
	require_once ("./include/articleMsg.inc.php");
	$articleDao = new Article();
			
	$id= mysql_escape_string($_GET['id']);
	$articleRow = $articleDao->queryById($id);//article info
			
	$articleTypeDao = new ArticleType();
	$typeRow = $articleTypeDao->queryById($articleRow[typeId]);//article type info
			
	$articleMsgDao = new ArticleMsg();
	$msgRows = $articleMsgDao->query($id);//article msg
?>
<!DOCTYPE HTML>
<html>
<head>
	<link rel="shortcut icon" href="res/icons/favicon.ico">
	<title><?php echo $articleRow['title'];?></title>
	<meta name="description" content="wzwahl36 王小为的技术博客  <?php echo $articleRow['title'];?>." />
	<meta name="keywords" content="wzwahl36, 王小为, Xewee Wang, <?php echo $articleRow['title'];?>" />
	<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
	<script type="text/javascript" src="./lib/jquery/jquery-1.6.js"></script>
	<script type="text/javascript">
		$(document).ready(function() {
			SyntaxHighlighter.highlight();
		});
	</script>
</head>

<body>
  <div id="main">
  <?php 
  	require_once ("./inc.header.php");
  ?>
    <div id="site_content">
      <?php
      	require_once ("./inc.right.php");
      ?>    
      <div id="content">
      	<h1><a href="blog.php?id=<?php echo $articleRow['id'];?>"><?php echo $articleRow['title'];?><?php echo $articleRow['top'] == '1' ? '&nbsp;&nbsp;&nbsp;<red>[HOT]</red>' : ''; ?></a></h1>
      	<p></p>
      	<div style="float:left;">
      		<a class="tag" href="list.php?id=<?php echo $typeRow['id'];?>">&nbsp;<?php echo $typeRow['name'];?>&nbsp;</a>
      	</div>
      	<div style="float:right;">
      		<a><?php echo $articleRow['adminId'];?></a> at <?php echo $articleRow['time'];?>&nbsp;&nbsp;&nbsp;&nbsp;
      	</div>
      	<p></p>
      	<p></p>
      		<?php echo htmlspecialchars_decode($articleRow['content']);?>
      	<p></p>
      	<!-- 
      	<p></p>
      	<script type="text/javascript">
			google_ad_client = "ca-pub-7292810486004926";
			/* Homepage_article */
			google_ad_slot = "0102123574";
			google_ad_width = 708;
			google_ad_height = 90;
		</script>
		<script type="text/javascript"
			src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
		</script>
		 -->
		<p></p>
      	<div class="seperator"></div>
      	<!-- msg list -->
      	<?php 
      		$count = 0;
      		foreach ($msgRows as $rows) {
      			$count ++;
      	?>
	      	<div class="aMsgBlock">
	      		<div style="float: left;"> FLOOR <?php echo $count;?>   &nbsp;&nbsp;&nbsp; [<a> <?php echo $rows['name'];?> </a>] said </div>
	      		<div style="float: right;"> at <a><?php echo $rows['time'];?></a></div>
	      		<p></p>
	      		<p><?php echo $rows['content'];?></p>
	      	</div>
		<?php }?>
      	<div class="seperator"> </div>
      	<form id="articleMsgAddForm" method="post" action="">
      		<div class="form_settings">
      			<p>
      				<span>Nick Name: </span>
      				<input value="" name="name" type="text">
      			</p>
      			<p>
      				<span>You Say:</span>
      				<textarea name="content" cols="50" rows="8"></textarea>
      			</p>
      			<p>
      				<span>&nbsp;</span>
      				<input onclick="javascript:sendArticleMsg(30);" class="submit" name="msg_submitted" value="SEND" type="button">
      			</p>
      		</div>
      	</form>
      </div>
    </div>
    <?php
    	require_once ("./inc.footer.php");
    ?>
  </div>
</body>
</html>